package io.wilson.rabbit.config;

import io.wilson.rabbit.common.constant.RabbitMQConstant;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutConfig {
    @Bean
    public FanoutExchange vocExchange() {
        return new FanoutExchange(RabbitMQConstant.VOC_EXCHANGE_NAME);
    }

    @Bean
    public Queue vocQueue() {
        return new Queue(RabbitMQConstant.VOC_QUEUE_NAME);
    }

    @Bean
    public Binding vocBinding(Queue vocQueue, FanoutExchange vocExchange) {
        return BindingBuilder.bind(vocQueue).to(vocExchange);
    }

    @Bean
    public Binding vocBindingOther(Queue directQueueA, FanoutExchange vocExchange) {
        return BindingBuilder.bind(directQueueA).to(vocExchange);
    }
}
